package cn.st4rlight.util.enums.items;

import org.apache.commons.lang3.StringUtils;

import cn.st4rlight.util.enums.HasCodeAndDesc;
import cn.st4rlight.util.report.enums.SortOrderType;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author st4rlight <st4rlight@163.com>
 * Created on 2025-09-15
 */
@Getter
@AllArgsConstructor
public enum EnumReqType {

    UNKNOWN(0, false, null),
    SORT_TYPE(1, false, SortOrderType.class)
    ;

    private final Integer code;
    private final boolean allowZero;
    private final Class<? extends Enum<? extends HasCodeAndDesc>> enumClass;


    public static EnumReqType nameOf(String name) {
        try {
            return EnumReqType.valueOf(StringUtils.upperCase(name));
        } catch (Exception ex) {
            return EnumReqType.UNKNOWN;
        }
    }
}
